﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserUpdatePwd.aspx.cs" Inherits="Wwtfly.BBS.ForeApplication.WebForm.UserUpdatePwd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
      <script src="Script/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Script/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Script/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="Script/md5.js" type="text/javascript"></script>
  
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <ul  style="text-align:center;  list-style:none;">
     <li>&nbsp;&nbsp;请输入旧密码：<input id="pwdold" type="password" value=""/></li>
     <li>&nbsp;&nbsp;请输入新密码：<input id="new1pwd" type="password" value="" /></li>
     <li>请再次输入新密码：<input id="new2pwd" type="password" value="" /></li>
     <li>   <input type="button" id="savepwd" value="保存" /><input type="reset" value="重置" /></li>
     </ul>
    </div>
    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#savepwd").click(function () {
                var oldpwd = $("#pwdold").val();
                if (oldpwd == "") {
                    alert("请输入旧密码!");
                    return;
                }
                var new1pwd = $("#new1pwd").val();
                if (new1pwd == "") {
                    alert("新密码不能为空!");
                    return;
                }
                var new2pwd = $("#new2pwd").val();
                if (new2pwd != new1pwd) {
                    alert("输入的两次密码不一致，请重新输入!");
                    return;
                }
                $.post("ashx/UsersHandler.ashx",
                                        { parms: "Update_userpwd",
                                            pwdold: hex_md52(oldpwd).toUpperCase(),
                                            newpwd: hex_md52(new2pwd).toUpperCase()
                                        }, function (result) {
                                            if (result == "1") {
                                                alert("修改密码成功! ");
                                                $("#pwdold").val("");
                                                $("#new1pwd").val("");
                                                $("#new2pwd").val("");
                                            } else if (result == "-1") {
                                                alert("您尚未登录!");
                                            }
                                            else if (result == "0") {
                                                alert("旧密码输入错误!");
                                            } else {
                                                alert("服务器繁忙...请稍后再试!");
                                            }
                                        });
            });

        });
    </script>
</body>
</html>
